Skip to content

feat(id-native-shell): Bevy audio renderer for audio/1 surfaces (#12657 step 2b) - #13244

Merged
dezren39 merged 1 commit into
mainfrom
lane-sy-12657
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-sy-12657

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Step 2b of #12657: the Bevy audio renderer in pkgs/id/crates/id-native-shell, following the two-layer shape step 2a (PR #13214) established for the scene renderer. Step 2c (widget renderer) remains after this, so #12657 stays open.

What lands

  • audio::AudioModel — a Bevy-independent presentation model. A validated AudioSurface becomes a cue schedule: cues sound one at a time in document order, each starting when the previous one ends; a repeating cue loops until the view changes (cues behind it wait indefinitely, and the schedule total is open-ended). Each cue also gets a derived fallback tone — thirteen semitone steps over the octave above 220 Hz, chosen by the cue id's FNV-1a hash — for presenters holding no world asset for the cue. cue_phase() is the pure phase function (Waiting / Sounding / Looping / Finished) the playback system and the tests share.
  • audio::AudioRenderPlugin — on each presented-view sequence change it despawns the old view's cue entities and spawns one entity per cue carrying its prescribed CueSchedule; a chained system keeps a Sounding marker on exactly the cues the phase function calls audible at the view's playhead. Non-audio views clear the cues and the playback state. Shells without the plugin keep presenting the audio text projection through ScreenGrid (parity test included).
  • audio::example_audio — the deterministic example world's audio: the harbor of example_scene (buoy bell, gulls, looping waves).
  • The binary registers AudioRenderPlugin beside SceneRenderPlugin.

Scope boundary, stated plainly: the plugin owns presentation state only. This crate's Bevy feature set carries no audio output backend (bevy_audio would pull rodio/cpal and need ALSA wiring in the flake), so device playback is a later wiring step that consumes these same entities and this same schedule. No new Cargo features were added.

Verification (laptop route, nix develop in pkgs/id; remote dispatch not used — the fleet-build container cannot run nix develop, the #13159-family gap):

  • cargo nextest run -p id-native-shell: 91 passed / 0 failed — the 81-test baseline plus 10 new audio tests (model determinism, back-to-back schedule + open-ended total, tone derivation bounds, phase function incl. repeat looping and cues behind a repeat, from_view gating, entity spawn with schedule fields, first-cue Sounding marker, clear on non-audio view, text-projection parity).
  • cargo fmt --check -p id-native-shell: clean.
  • Clippy: no findings in the new module (verified with a cap-lints run reaching the crate; the un-capped workspace run still stops earlier on the pre-existing id-store expect() sites tracked by id-store: admission.rs expect() on Mutex locks breaks the clippy gates on main (PR #13156) #13207 — untouched here).
{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T12:16:42Z",
    "session_id": null,
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/wt-lane-sy-12657",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/wt-lane-sy-12657",
      "repo": "developing-today/code",
      "branch": "lane-sy-12657",
      "sha": "538f48fe95f4b6e4be26efa4bd6e6b9a3a9105e0"
    },
    "auth_subject": "codex-scheduled-b",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… step 2b)

Two layers mirroring the step-2a scene renderer, all in
pkgs/id/crates/id-native-shell:

- audio::AudioModel — a Bevy-independent presentation model: a
  validated AudioSurface becomes a cue schedule (cues sound one at
  a time in document order, each starting when the previous ends;
  a repeating cue loops until the view changes and later cues wait
  indefinitely) plus a fallback tone per cue, stepped
  deterministically from the cue id over the octave above 220 Hz.
  cue_phase() is the pure phase function the playback system and
  the tests share.
- audio::AudioRenderPlugin — on each presented-view sequence
  change, one entity per cue carrying its prescribed CueSchedule;
  a chained system keeps a Sounding marker on exactly the cues the
  phase function calls audible at the view's playhead. Non-audio
  views clear the cue entities and playback state. The plugin owns
  presentation state only: the crate's Bevy feature set carries no
  audio output backend, so device playback is a later wiring step
  over the same entities and schedule.
- audio::example_audio — the deterministic example world's audio
  (the harbor of example_scene: buoy bell, gulls, looping waves).

The binary registers AudioRenderPlugin beside SceneRenderPlugin.
Shells without the plugin keep the audio text projection through
ScreenGrid (parity test included).

Verification (laptop, nix develop in pkgs/id): cargo nextest run
-p id-native-shell 91 passed / 0 failed (81 baseline + 10 new audio
tests: model determinism, back-to-back schedule + open-ended total,
tone derivation bounds, phase function incl. repeat looping and
cues behind a repeat, from_view gating, entity spawn + schedule
fields, first-cue sounding marker, clear on non-audio view, text
projection parity); cargo fmt clean; clippy has no findings in the
new module (the workspace clippy run still stops earlier on the
pre-existing id-store expect() sites tracked by #13207, untouched).
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ef8ccd2-4924-43c5-9cd9-19a0eef6fa49
Commits

Reviewing files that changed from the base of the PR and between af11969 and 538f48f.

Files selected for processing: 4

  • pkgs/id/crates/id-native-shell/Cargo.toml
  • pkgs/id/crates/id-native-shell/src/audio.rs
  • pkgs/id/crates/id-native-shell/src/lib.rs
  • pkgs/id/crates/id-native-shell/src/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit 7fecf88 into main Nov 23, 2026
2 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T12:18:18.127328Z 538f48f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant